package com.t373.log;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author Jane
 * @date 2024-12-16 11:51
 */
@Aspect
@Component
public class MyLog {

    //定义一个切点
    @Pointcut("execution(* com.t373.service..*.get*(..))")
    public void pointcut(){}
    //前置增强
    @Before(value="pointcut()")
    public void record(JoinPoint jp){
//        System.out.println(jp.getTarget());
//        System.out.println(jp.getSignature());
//        System.out.println(jp.getArgs());
        System.out.println("[前置增强A]添加一份健康证明");
    }

    //@AfterReturning(value = "execution(* com.t373.service..*.*(..))",returning = "resultAAAA")
    @AfterReturning(value ="pointcut()" ,returning = "resultAAAA")
    public void pay(JoinPoint jp,Object resultAAAA){
//        System.out.println(jp.getTarget());
//        System.out.println(jp.getSignature());
//        System.out.println(jp.getArgs());
        System.out.println("[后置增强A]-支付"+resultAAAA);
    }
}
